package com.wwk.phone.controller;

import com.wwk.phone.entity.Book;
import com.wwk.phone.entity.User;
import com.wwk.phone.exceptionhandler.MyException;
import com.wwk.phone.service.UserService;
import com.wwk.phone.utils.JwtUtils;
import com.wwk.phone.utils.R;
import com.wwk.phone.utils.ResultCode;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * (User)表控制层
 *
 * @author makejava
 * @since 2023-06-05 15:00:17
 */
@RestController
@RequestMapping("user")
@CrossOrigin
public class UserController {
    /**
     * 服务对象
     */
    @Resource
    private UserService userService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public R queryById(@PathVariable("id") Long id) {
        return R.ok().data("user",this.userService.queryById(id));
    }
}

